﻿[
{
    "name": "Device Containers",
    "desc": "Displays the list of Device containers, with their container id, display name and model name",
    "source": function () {
        var obj = [];
        var propertiesToRetrieve = ["System.ItemNameDisplay", "System.Devices.ModelName"];
        var DevEnum = Windows.Devices.Enumeration;
        var Pnp = DevEnum.Pnp;
        var pnpObjType = Pnp.PnpObjectType;
        var deviceContainerType = pnpObjType.deviceContainer;

        Windows.Devices.Enumeration.Pnp.PnpObject.findAllAsync(deviceContainerType, propertiesToRetrieve).then(function (devinfoCollection) {
            var numDevices = devinfoCollection.length;
            console.log(numDevices + " device containers(s) found");
            if (numDevices) {
                for (var i = 0; i < numDevices; i++) {
                    var cont = [];
                    cont.push("Container ID: " + devinfoCollection[i].id);
                    var prop = devinfoCollection[i].properties;
                    var pt = prop.first();
                    while (pt.hasCurrent) {
                        cont.push(pt.current.key + " := " + pt.current.value);
                        pt.moveNext();
                    }
                    obj.push(cont);
                }
                console.log(obj);
            }
            else {
                console.log("No devices found");
            }
        },
        function (e) {
            console.log("Failed to find devices, error: " + e.message);
        });
    }
},

{
    "name": "Keyboard Capabilities",
    "desc": "Supports the ability to determine the capabilities of any connected hardware keyboards. ",
    "source": function () {
        var keyboardCapabilities = new Windows.Devices.Input.KeyboardCapabilities();
        console.log("Is keyboard present " + keyboardCapabilities.keyboardPresent);
    }
},
{
    "name": "Pointer Device",
    "desc": "Supports the ability to identify the connected pointer devices and determine their capabilities.",
    "source": function () {
        var pointerDevice = Windows.Devices.Input.PointerDevice;
        console.log("Whether the pointer device is integrated " + pointerDevice.IsIntegrated);
        console.log("Maximum contacts " + pointerDevice.MaxContacts);
        console.log("Rect in device coordinates " + pointerDevice.PhysicalDeviceRect);
        console.log("Pointer device type. " + pointerDevice.PointerDeviceType);
        console.log("Rect in screen coordinates " + pointerDevice.ScreenRect);
    }
},
{
    "name": "Mouse Capabilities",
    "desc": "Supports the ability to determine the capabilities of any connected hardware mice. ",
    "source": function () {
        var mouseCapabilities = new Windows.Devices.Input.MouseCapabilities();
        console.log("Mouse Present " + mouseCapabilities.mousePresent);
        console.log("Number of Buttons " + mouseCapabilities.numberOfButtons);
        console.log("Are mouse buttons swapped " + mouseCapabilities.swapButtons);
        console.log("Vertical Wheel Present" + mouseCapabilities.verticalWheelPresent);
        console.log("Horizontal Wheel Present " + mouseCapabilities.horizontalWheelPresent);
    }
},
{
    "name": "Touch Capabilities",
    "desc": "Supports the ability to determine the touch capabilities of any connected touch digitizers. ",
    "source": function () {
        var touchCapabilities = new Windows.Devices.Input.TouchCapabilities();
        console.log("Computer has any digitizer " + touchCapabilities.touchPresent);
        console.log("Minimum number of contacts supported by all the digitizers " + touchCapabilities.contacts);
    }
},
]